package com.sunny;

import java.util.Scanner;

public class Main {

    private static final int MAXN = 105;
    private static final int MOD = 1000000007;

    private static long[] fac = new long[MAXN];


    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int K = scanner.nextInt();
        int A = scanner.nextInt();
        int X = scanner.nextInt();
        int B = scanner.nextInt();
        int Y = scanner.nextInt();

        ini(100);
        long res = 0;
        for(int i=0;i<=X;i++){
            for(int j=0;j<=Y;j++){
                if(A*i+B*j==K){
                    res = (res+c(X,i)*c(Y,j)%MOD)%MOD;
                }
            }
        }
        System.out.println(res);

    }
    private static long pow(long x, int k){
        long ans = 1;
        while (k != 0){
            if((k&1)>0){
                ans = ans*x%MOD;
            }
            x = x*x%MOD;
            k >>= 1;
        }
        return ans;
    }

    private static void ini(int n){
        fac[0] = 1;
        for(int i=1; i<=n; i++){
            fac[i] = fac[i-1]*i % MOD;
        }
    }

    private static long inv(long a) {
        return pow(a, MOD - 2);
    }

    private static long c(int n,int m)
    {
        if (n<m)
            return 0;
        return fac[n]*inv(fac[m])%MOD*inv(fac[n-m])%MOD;
    }
}